﻿using System.Linq;

namespace dPet.Infrastructure.EntityFramework.Repositories
{
	using dPet.Domain.Models;
	using dPet.Domain.Repositories;
	using dPet.Domain.Specifications;
	using Hangerd.EntityFramework;
	using Hangerd.Repository;

	public class StaffRepository : EfRepository<Staff>, IStaffRepository
	{
		public StaffRepository(IRepositoryContext unitOfWork)
			: base(unitOfWork)
		{ }

		public bool ExistLoginName(string loginName)
		{
			var spec = StaffSpecifications.LoginNameEquals(loginName);

			return base.GetAll(spec, false).Count() > 0;
		}
	}
}
